Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
27 lines (18 loc) · 737 Bytes

3.9.9 - Coroutine/PostgreSQL->fetchRow.md

File metadata and controls

27 lines (18 loc) · 737 Bytes

Coroutine\PostgreSQL->fetchRow

fetchRow() 根据指定的 result 资源提取一行数据(记录)作为数组返回。每个得到的列依次存放在数组中,从偏移量 0 开始。

function Coroutine\PostgreSQL-> fetchRow ( resource $queryResult [, int $row ] )

返回的数组和提取的行相一致。如果没有更多行 row 可提取,则返回 FALSE。

example:

go(function () {

    $pg = new Swoole\Coroutine\PostgreSQL();
    $conn  = $pg  -> connect ("host=127.0.0.1 port=5432 dbname=test user=wuzhenyu");
    $result = $pg ->query('SELECT * FROM test;');
    while ($row = $pg->fetchRow($result)) {
        echo "name: $row[0]  mobile: $row[1]";
        echo "<br />\n";
    }

});